Skip to content

test: open stores saved by v1.4 and v1.5 with today's schema - #109

Merged
ykisana merged 1 commit into
mainfrom
test/store-upgrade-from-older-releases
Nov 15, 2026
Merged

ykisana merged 1 commit into
mainfrom
test/store-upgrade-from-older-releases

Conversation

@ykisana

@ykisana ykisana commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Problem

The app opens its store with try! (NormalApp.swift), so a store that can't migrate crashes on every launch. No test opens a store in an older release's format:

  • The migration tests open stores with hand-copied model lists, and none includes UsageLimit.
  • Key tests create and check a key with the same code, so changing the hash would pass them while breaking every existing key.

Change

  • StoreUpgradeTests holds frozen copies of the v1.4 and v1.5 models: stored properties, enum raw values, and a key salt and hash computed outside the app. Each test writes a store with the old models and reopens it with the app's schema.
    • v1.5 is the only release since v1.4 that changed stored properties. A v1.5 store matches v1.6 and v1.7.
  • NormalApp.models is the one model list. The app and every test container use it, replacing 5 copies in the tests.

No behavior change.

Tests

  • Full unit suite on iPhone 17, iOS 27: 879/879.
  • The 5 changed suites on iPhone 15, iOS 17.5: 16/16.
  • Each mutation below fails the new tests:
Mutation Result
PBKDF2 round count changed key tests fail
Enum raw value changed SwiftData crashes while decoding, as the app would on launch
New required Settings field all 4 fail with "Cannot migrate store in-place"
hideDonateButton renamed without originalName Settings test fails: the saved value is lost

@ykisana
ykisana merged commit 912bbab into main Nov 15, 2026
1 check passed
@ykisana
ykisana deleted the test/store-upgrade-from-older-releases branch November 15, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant